/**
 * 统一封装全局消息
 */
import { ElMessage } from 'element-plus'
import { ElNotification, ElMessageBox } from 'element-plus'
export const RmMessage = {
  success(msg, time = 1500) {
    ElMessage({
      message: msg,
      type: 'success',
      showClose: true,
      duration: time,
    })
  },
  warning(msg, time = 1500) {
    ElMessage({
      message: msg,
      type: 'warning',
      showClose: true,
      duration: time,
    })
  },
  error(msg, time = 1500) {
    ElMessage({
      message: msg,
      type: 'error',
      showClose: true,
      duration: time,
    })
  },
  info(msg, time = 1500) {
    ElMessage({
      message: msg,
      type: 'info',
      showClose: true,
      duration: time,
    })
  },
}

export const Notifcation = {
  success(msg, title, time = 1500) {
    ElNotification({
      type: 'success',
      message: msg,
      title: title,
      duration: time,
    })
  },
  warning(msg, title, time = 1500) {
    ElNotification({
      type: 'warning',
      message: msg,
      title: title,
      duration: time,
    })
  },
  error(msg, title, time = 1500) {
    ElNotification({
      type: 'error',
      message: msg,
      title: title,
      duration: time,
    })
  },
  info(msg, title, time = 1500) {
    ElNotification({
      type: 'info',
      message: msg,
      title: title,
      duration: time,
    })
  },
}

export function showCheckBox(content = '提示内容', title = '') {
  return ElMessageBox.confirm(
    content,
    title,
    {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning'
    }
  )
}

